﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Autocentro.Entities;

namespace Autocentro.Respository.Mapping
{
    public class VentaMap:EntityTypeConfiguration<VENTA>
    {
        public VentaMap()
        {
            this.HasKey(p=>p.Id);

            this.Property(p => p.Fecha)
                .IsRequired();

            this.Property(p => p.Total)
                .HasPrecision(18, 2);

            this.ToTable("VENTA");
            this.Property(p => p.Id).HasColumnName("Id");
            this.Property(p => p.Fecha).HasColumnName("Fecha");
            this.Property(p => p.Total).HasColumnName("Total");
            this.Property(p => p.Cancelada).HasColumnName("Cancelada");

            this.HasRequired(p => p.Cliente)
                .WithMany(c => c.Venta)
                .HasForeignKey(p => p.IdCliente);

        }
    }
}
